/*LICENSE_BEGIN
 * ******************************************************************
 * All original parts of SoccerScope2003 have copyright (2003) by
 * Team YowAI, represented by Mr. Shuhei Shiota
 * The Department of Creative Informatics
 * The Graduate School of Information Science and Technology
 * The University of Tokyo
 * 
 * Additional classes (except libraries in /lib) were developed by 
 * the Dainamite Robocup-Team of the DAI-Labor, TU-Berlin 
 * (www.dai-labor.de)
 * 
 * Extended/new classes/packages are:
 *   soccerscope.analyzer.LogfileAnalyzer
 *   soccerscope.daistatistic.*
 *   soccerscope.daistatistic.charts.*
 *   soccerscope.daistatistic.tools.*
 *   soccerscope.db.*
 *   soccerscope.dialog.*
 *   soccerscope.model.PlayerWorldModel
 *   soccerscope.model.SimplePlayer
 *   soccerscope.net.AgentConnector
 *   soccerscope.training.*
 *   soccerscope.training.conditions.*
 * ******************************************************************
LICENSE_END*/
package soccerscope.model;

import java.io.Serializable;

public class GameEvent implements Comparable<GameEvent>, Serializable {

    /**
     * id for serialization. 
     */
    private static final long serialVersionUID = 3256726186435426101L;

    public final static int MIN = 1;

	public final static int GOAL = 1;

	public final static int GOAL_KICK = 2;

	public final static int GOALIE_CATCH = 3;

	public final static int OFFSIDE = 4;

	public final static int BACKPASS = 5;

	public final static int FREE_KICK_FAULT = 6;

	public final static int CORNER_KICK = 7;

	public final static int FREE_KICK = 8;

	public final static int KICK_IN = 9;

	public final static int SHOOT = 10;

	public final static int PASS = 11;

	public final static int MAX = 12;

	private final static String name[] = { " ", "Goal", "Goal_Kick",
			"Goalie_Catch", "Offside", "Back_Pass", "Free_Kick_Fault",
			"Corner_Kick", "Free_Kick", "Kick_In", "Shoot", "Pass" };

	public int time;

	public int type;

	public GameEvent(int time, int type) {
		this.time = time;
		this.type = type;
	}

	@Override
  public boolean equals(Object o) {
		return (this.time == ((GameEvent) o).time) && (this.type == ((GameEvent) o).type);
	}

	public int compareTo(GameEvent obj) {
		return this.time - ((GameEvent) obj).time;
	}

	public String getEventName() {
		return name[this.type];
	}

	public static String getEventName(int type) {
		return name[type];
	}

	@Override
  public String toString() {
		return String.valueOf(this.time) + ": " + name[this.type];
	}
}
